package site.marqstree.kotlin.library.good.ui.fragment.category.centent.recyclerview

import android.widget.ImageView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.module.LoadMoreModule
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import site.marqstree.kotlin.library.base.util.GlideUtil
import site.marqstree.kotlin.library.good.R
import site.marqstree.kotlin.library.good.ui.activity.goodlist.bean.GoodBean
import site.marqstree.kotlin.library.good.ui.activity.goodlist.recyclerview.CustomLoadMoreView


/*
 * 项目名: KotlinMall
 * 包名: site.marqstree.kotlin.library.good.ui.fragment.category.centent.recyclerview
 * 文件名: ContentAdapter
 * 创建者: marqstree
 * 创建时间: 2020/3/7 15:07
 * 描述: TODO
 */
class GoodListAdapter(val mList:MutableList<GoodBean>)
            : BaseQuickAdapter<GoodBean, BaseViewHolder>(R.layout.item_good_list,mList),
            LoadMoreModule {
    init{
        animationEnable = true
        loadMoreModule?.loadMoreView = CustomLoadMoreView()
    }

    override fun convert(helper: BaseViewHolder, item: GoodBean) {
        helper.setText(R.id.mGoodTitle,item.title)
        helper.setText(R.id.mGoodDescTv,item.desc)
        helper.setText(R.id.mGoodStockTv,"库存 "+item.count.toString())
        helper.setText(R.id.mGoodPriceTv,"￥"+item.price.toString())
        GlideUtil.loadImage(context,
                item.thumb,
                helper.getView<ImageView>(R.id.mGoodsIconIv))
    }


}